import xlrd

data = xlrd.open_workbook('19宿舍.xls')
table = data.sheet_by_name('19宿舍')

name = 2
Class = 1

block = 3
num = 4
dead = 5

l = 43

def getCell(x,y):
    return str(table.cell(x, y).value)

allRoom={}

def findRoom(itname):
    for i in range(1,l):
        if getCell(i,name)==itname:
            room=getCell(i,block)+getCell(i,num)[0:3]
            if not room in list(allRoom.keys()):
                allRoom[room]=[itname]
            else:
                allRoom[room].append(itname)
            return room

class defunct:
    def __init__(self,name):
        self.name=name
        self.level=0
allDefunct=[]

for i in range(1,l):
    if getCell(i,dead)=='死亡':
        allDefunct.append(defunct(getCell(i,name)))

def isDead(name):
    for i in allDefunct:
        if i.name==name:
            return True
    return False